Manages the sahders available in the component. More...
Public Member Functions | |
~ProgramManager () | |
Program * | createOrRetrieve (const nkMemory::StringView &name) |
Program * | get (const nkMemory::StringView &name) |
Program * | getByIndex (unsigned int index) |
void | rename (const nkMemory::StringView &oldName, const nkMemory::StringView &newName) |
void | erase (const nkMemory::StringView &name) |
unsigned int | getIdForInputSemantics (Program *program) |
void | addCustomSemanticIndex (const nkMemory::StringView &semanticName, int assignedIndex) |
int | getCustomSemanticIndex (const nkMemory::StringView &semanticName) |
Manages the sahders available in the component.
The manager is responsible for the allocated memory it returns. External code should never delete returned memory.
nkGraphics::ProgramManager::~ProgramManager | ( | ) |
Destructor.
Program* nkGraphics::ProgramManager::createOrRetrieve | ( | const nkMemory::StringView & | name | ) |
Creates if unavailable, or retrieve if available, a program.
name | The name of the program to retrieve. |
Program* nkGraphics::ProgramManager::get | ( | const nkMemory::StringView & | name | ) |
Retrieves an existing program.
name | The name of the program to retrieve. |
Program* nkGraphics::ProgramManager::getByIndex | ( | unsigned int | index | ) |
Retrieves a program by index. Note that an index can point to different programs as the memory of the manager is changed. Useful to loop over all available programs in one go.
index | The index of the program to retrieve. |
void nkGraphics::ProgramManager::rename | ( | const nkMemory::StringView & | oldName, |
const nkMemory::StringView & | newName | ||
) |
Renames a program, changing both its name and the way to find it in the manager.
oldName | The name of the program to alter. |
newName | The new name to assign. |
void nkGraphics::ProgramManager::erase | ( | const nkMemory::StringView & | name | ) |
Erases a program and frees its memory.
name | The name of the program to erase. |
unsigned int nkGraphics::ProgramManager::getIdForInputSemantics | ( | Program * | program | ) |
Allows to retrieve the id associated to an input semantic of a program.
program | The program whose input semantic is to inspect. |
void nkGraphics::ProgramManager::addCustomSemanticIndex | ( | const nkMemory::StringView & | semanticName, |
int | assignedIndex | ||
) |
Allows to specify a custom index for semantic tracking.
semanticName | The semantic name to create. |
assignedIndex | The index to attach. |
int nkGraphics::ProgramManager::getCustomSemanticIndex | ( | const nkMemory::StringView & | semanticName | ) |
semanticName | The semantic name. |